package com.swfcamp.shopper
{
	import flash.events.Event;

	public class ProductEvent extends Event
	{
		protected var _product:IProduct;
		
		public static const PRODUCT_FOUND:String = "com.swfcamp.shopper.ProductEvent:ProductFound";
		public static const PRODUCT_NOT_FOUND:String = "com.swfcamp.shopper.ProductEvent:ProductNotFound";
		public static const PRODUCT_ADDED:String = "com.swfcamp.shopper.ProductEvent:ProductAdded";
		public static const PRODUCT_REMOVED:String = "com.swfcamp.shopper.ProductEvent:ProductRemoved";
		
		public function ProductEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, p:IProduct=null)
		{
			super(type, bubbles, cancelable);
			this._product = p;
		}
		
		public function get product():IProduct{
			return this._product;
		}
		
		override public function clone():Event{
			return new ProductEvent(type,bubbles,cancelable,product);
		}
		
		override public function toString():String{
			return formatToString("ProductEvent", "type", "bubbles", "cancelable", "product");
		}
		
	}
}